package com.glsc.ngateway.opmanage.controller.deposit;

import com.glsc.ngateway.common.api.platform.resp.PlatformResponse;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.User;
import com.glsc.ngateway.common.base.domain.mysql.opmanagemain.deposit.DepositoryPaymentPlanXinYiLog;
import com.glsc.ngateway.opmanage.aspect.UserCache;
import com.glsc.ngateway.opmanage.dto.DepositoryPaymentDto;
import com.glsc.ngateway.opmanage.service.deposit.DepositoryPaymentPlanService;
import com.glsc.ngateway.opmanage.service.deposit.DepositoryPaymentPlanXinYiLogService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;


/**
 * 保证金划款方案日志
 */
@RestController
@RequestMapping("/api/depository/paymentPlanXinYiLog")
@Slf4j
public class DepositoryPaymentPlanXinYiLogController {

    @Resource
    private DepositoryPaymentPlanXinYiLogService depositoryPaymentPlanXinYiLogService;

    @Resource
    private UserCache userCache;


    /**
     * 分页查询划款方案日志
     *
     * @param dto
     * @param request
     * @return
     */
    @PostMapping("/page")
    public PlatformResponse<Page<DepositoryPaymentPlanXinYiLog>> pageTemplate(@RequestBody DepositoryPaymentDto dto, HttpServletRequest request) {

        Map<String, Object> param = new HashMap<>();
        if (StringUtils.isNotBlank(dto.getName())) {
            param.put("LIKE_name", dto.getName());
        }

        Page<DepositoryPaymentPlanXinYiLog> page = depositoryPaymentPlanXinYiLogService.page(dto.getPageNo(), dto.getPageSize(), param);

        return PlatformResponse.successData(page);
    }


}
